#!/usr/bin/perl
# ----------------------------------------------------------------- #
#           The HMM-Based Speech Synthesis System (HTS)             #
#           developed by HTS Working Group                          #
#           http://hts.sp.nitech.ac.jp/                             #
# ----------------------------------------------------------------- #
#                                                                   #
#  Copyright (c) 2001-2015  Nagoya Institute of Technology          #
#                           Department of Computer Science          #
#                                                                   #
#                2001-2008  Tokyo Institute of Technology           #
#                           Interdisciplinary Graduate School of    #
#                           Science and Engineering                 #
#                                                                   #
# All rights reserved.                                              #
#                                                                   #
# Redistribution and use in source and binary forms, with or        #
# without modification, are permitted provided that the following   #
# conditions are met:                                               #
#                                                                   #
# - Redistributions of source code must retain the above copyright  #
#   notice, this list of conditions and the following disclaimer.   #
# - Redistributions in binary form must reproduce the above         #
#   copyright notice, this list of conditions and the following     #
#   disclaimer in the documentation and/or other materials provided #
#   with the distribution.                                          #
# - Neither the name of the HTS working group nor the names of its  #
#   contributors may be used to endorse or promote products derived #
#   from this software without specific prior written permission.   #
#                                                                   #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND            #
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,       #
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF          #
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE          #
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS #
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,          #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED   #
# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     #
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON #
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,   #
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY    #
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE           #
# POSSIBILITY OF SUCH DAMAGE.                                       #
# ----------------------------------------------------------------- #


# Settings ==============================
$fclf        = '@FULLCONTEXT_FORMAT@';
$fclv        = '@FULLCONTEXT_VERSION@';
$dset        = '@DATASET@';
$spkr        = '@SPEAKER@';
$qnum        = '@QNUM@';
$ver         = '@VER@';
$usestraight = '@USESTRAIGHT@';

@SET        = ('cmp','dur');
@cmp     = ('mgc','lf0','bap');
@dur        = ('dur');
$ref{'cmp'} = \@cmp;
$ref{'dur'} = \@dur;

%vflr = ('mgc' => '0.01',           # variance floors
         'lf0' => '0.01',
         'bap' => '0.01',
         'dur' => '0.01');

%thr  = ('mgc' => '000',            # minimum likelihood gain in clustering
         'lf0' => '000',
         'bap' => '000',
         'dur' => '000');

%mdlf = ('mgc' => '1.0',            # tree size control param. for MDL
         'lf0' => '1.0',
         'bap' => '1.0',
         'dur' => '1.0');

%mocc = ('mgc' => '10.0',           # minimum occupancy counts
         'lf0' => '10.0',
         'bap' => '10.0',
         'dur' => ' 5.0');

%gam  = ('mgc' => '000',            # stats load threshold
         'lf0' => '000',
         'bap' => '000',
         'dur' => '000');

%t2s  = ('mgc' => 'cmp',            # feature type to mmf conversion
         'lf0' => 'cmp',
         'bap' => 'cmp',
         'dur' => 'dur');

%strb = ('mgc' => '@MGCSTRST@',     # stream start
         'lf0' => '@LF0STRST@',
         'bap' => '@BAPSTRST@',
         'dur' => '1');

%stre = ('mgc' => '@MGCSTREN@',     # stream end
         'lf0' => '@LF0STREN@',
         'bap' => '@BAPSTREN@',
         'dur' => '@NSTATE@');

%msdi = ('mgc' => '0',              # msd information
         'lf0' => '1',
         'bap' => '0',
         'dur' => '0');

%strw = ('mgc' => '1.0',            # stream weights
         'lf0' => '1.0',
         'bap' => '0.0',
         'dur' => '1.0');

%ordr = ('mgc' => '@MGCVSIZE@',     # feature order
         'lf0' => '1',
         'bap' => '@BAPVSIZE@',
         'dur' => '@NSTATE@');

%nwin = ('mgc' => '@NMGCWIN@',      # number of windows
         'lf0' => '@NLF0WIN@',
         'bap' => '@NBAPWIN@',
         'dur' => '0');

%nblk = ('mgc' => '@NMGCTRANSBLK@', # number of blocks for transforms
         'lf0' => '@NLF0TRANSBLK@',
         'bap' => '@NBAPTRANSBLK@',
         'dur' => '1');

%band = ('mgc' => '@MGCBANDWIDTH@', # band width for transforms
         'lf0' => '@LF0BANDWIDTH@',
         'bap' => '@BAPBANDWIDTH@',
         'dur' => '0');

%gvthr  = ('mgc' => '000',          # minimum likelihood gain in clustering for GV
           'lf0' => '000',
           'bap' => '000');

%gvmdlf = ('mgc' => '1.0',          # tree size control for GV
           'lf0' => '1.0',
           'bap' => '1.0');

%gvgam  = ('mgc' => '000',          # stats load threshold for GV
           'lf0' => '000',
           'bap' => '000');

%mspfe  = ('mgc' => '1.0');         # emphasis coefficient of modulation spectrum-based postfilter

@slnt = ('pau','h#','brth');        # silent and pause phoneme

#%mdcp = ('dy' => 'd',              # model copy
#         'A'  => 'a',
#         'I'  => 'i',
#         'U'  => 'u',
#         'E'  => 'e',
#         'O'  => 'o');


# Speech Analysis/Synthesis Setting ==============
# speech analysis
$sr = @SAMPFREQ@;   # sampling rate (Hz)
$fs = @FRAMESHIFT@; # frame period (point)
$fw = @FREQWARP@;   # frequency warping
$gm = @GAMMA@;      # pole/zero representation weight
$lg = @LNGAIN@;     # use log gain instead of linear gain

# speech synthesis
$pf_mcp = @PSTFILTER_MCP@; # postfiltering factor for mel-cepstrum
$pf_lsp = @PSTFILTER_LSP@; # postfiltering factor for LSP
$fl     = @IMPLEN@;        # length of impulse response
$co     = 2047;            # order of cepstrum to approximate mel-cepstrum


# Modeling/Generation Setting ==============
# modeling
$nState      = @NSTATE@;        # number of states
$nIte        = @NITER@;         # number of iterations for embedded training
$beam        = '1500 100 5000'; # initial, inc, and upper limit of beam width
$maxdev      = @MAXDEV@;        # max standard dev coef to control HSMM maximum duration
$mindur      = @MINDUR@;        # min state duration to be evaluated
$wf          = @WFLOOR@;        # mixture weight flooring
$initdurmean = 3.0;             # initial mean of state duration
$initdurvari = 10.0;            # initial variance of state duration
$daem        = @DAEM@;          # DAEM algorithm based parameter estimation
$daem_nIte   = @DAEMNITER@;     # number of iterations of DAEM-based embedded training
$daem_alpha  = @DAEMALPHA@;     # schedule of updating temperature parameter for DAEM

# generation
$pgtype     = @PGTYPE@;     # parameter generation algorithm (0 -> Cholesky,  1 -> MixHidden,  2 -> StateHidden)
$maxEMiter  = @MAXEMITER@;  # max EM iteration
$EMepsilon  = @EMEPSILON@;  # convergence factor for EM iteration
$useGV      = @USEGV@;      # turn on GV
$maxGViter  = @MAXGVITER@;  # max GV iteration
$GVepsilon  = @GVEPSILON@;  # convergence factor for GV iteration
$minEucNorm = @MINEUCNORM@; # minimum Euclid norm for GV iteration
$stepInit   = @STEPINIT@;   # initial step size
$stepInc    = @STEPINC@;    # step size acceleration factor
$stepDec    = @STEPDEC@;    # step size deceleration factor
$hmmWeight  = @HMMWEIGHT@;  # weight for HMM output prob.
$gvWeight   = @GVWEIGHT@;   # weight for GV output prob.
$optKind    = '@OPTKIND@';  # optimization method (STEEPEST, NEWTON, or LBFGS)
$nosilgv    = @NOSILGV@;    # GV without silent and pause phoneme
$cdgv       = @CDGV@;       # context-dependent GV
$useMSPF    = @USEMSPF@;    # use modulation spectrum-based postfilter
$mspfLength = 25;           # frame length of modulation spectrum-based postfilter (odd number)
$mspfFFTLen = 64;           # FFT length of modulation spectrum-based postfilter (even number)


# Directories & Commands ===============
# project directories
$prjdir = '@PWD@';

# Perl
$PERL = '@PERL@';

# wc
$WC = '@WC@';

# HTS commands
$HCOMPV    = '@HCOMPV@';
$HLIST     = '@HLIST@';
$HINIT     = '@HINIT@';
$HREST     = '@HREST@';
$HEREST    = '@HEREST@';
$HHED      = '@HHED@';
$HSMMALIGN = '@HSMMALIGN@';
$HMGENS    = '@HMGENS@';
$ENGINE    = '@ENGINE@';

# SPTK commands
$X2X          = '@X2X@';
$FREQT        = '@FREQT@';
$C2ACR        = '@C2ACR@';
$VOPR         = '@VOPR@';
$VSUM         = '@VSUM@';
$MC2B         = '@MC2B@';
$SOPR         = '@SOPR@';
$B2MC         = '@B2MC@';
$EXCITE       = '@EXCITE@';
$LSP2LPC      = '@LSP2LPC@';
$MGC2MGC      = '@MGC2MGC@';
$MGLSADF      = '@MGLSADF@';
$MERGE        = '@MERGE@';
$BCP          = '@BCP@';
$LSPCHECK     = '@LSPCHECK@';
$MGC2SP       = '@MGC2SP@';
$BCUT         = '@BCUT@';
$VSTAT        = '@VSTAT@';
$NAN          = '@NAN@';
$DFS          = '@DFS@';
$SWAB         = '@SWAB@';
$RAW2WAV      = '@RAW2WAV@';
$FRAME        = '@FRAME@';
$WINDOW       = '@WINDOW@';
$SPEC         = '@SPEC@';
$TRANSPOSE    = '@TRANSPOSE@';
$PHASE        = '@PHASE@';
$IFFTR        = '@IFFTR@';

# MATLAB & STRAIGHT
$MATLAB   = '@MATLAB@';
$STRAIGHT = '@STRAIGHT@';

$NUMPROC = 1;
$NUMPHON = 20;
$NUMCL = 2;

# Switch ================================
$MKEMV = 1; # preparing environments
$HCMPV = 1; # computing a global variance
$IN_RE = 1; # initialization & reestimation
$MMMMF = 1; # making a monophone mmf
$ERST0 = 1; # embedded reestimation (monophone)
$MN2FL = 1; # copying monophone mmf to fullcontext one
$ERST1 = 1; # embedded reestimation (fullcontext)
$CXCL1 = 1; # tree-based context clustering
$ERST2 = 1; # embedded reestimation (clustered)
$UNTIE = 1; # untying the parameter sharing structure
$ERST3 = 1; # embedded reestimation (untied)
$CXCL2 = 1; # tree-based context clustering
$ERST4 = 1; # embedded reestimation (re-clustered)
$FALGN = 1; # forced alignment for no-silent GV
$MCDGV = 1; # making global variance
# $MKUNG = 1; # making unseen models (GV)
# $TMSPF = 1; # training modulation spectrum-based postfilter
# $MKUN1 = 1; # making unseen models (1mix)
# $PGEN1 = 1; # generating speech parameter sequences (1mix)
# $WGEN1 = 1; # synthesizing waveforms (1mix)
$CONVM = 1; # converting mmfs to the hts_engine file format
#$ENGIN = 1; # synthesizing waveforms using hts_engine
# $SEMIT = 1; # semi-tied covariance matrices
# $MKUNS = 1; # making unseen models (stc)
# $PGENS = 1; # generating speech parameter sequences (stc)
# $WGENS = 1; # synthesizing waveforms (stc)
# $UPMIX = 1; # increasing the number of mixture components (1mix -> 2mix)
# $ERST5 = 1; # embedded reestimation (2mix)
# $MKUN2 = 1; # making unseen models (2mix)
# $PGEN2 = 1; # generating speech parameter sequences (2mix)
# $WGEN2 = 1; # synthesizing waveforms (2mix)

1;
